package com.example.demo.Service.ServerImpl;

import com.example.demo.Service.DishesService;
import com.example.demo.repository.dao.DishesDao;
import com.example.demo.repository.domain.Dishes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ZhangKe
 * @Description
 * @date 2019/7/4 12:33.
 */
@Service
public class DishesServiceImpl implements DishesService {

    @Autowired
    private DishesDao dishesDao;

    /**
     * 根据ID查找
     *
     * @param id id
     * @return 测试实体类
     */
    @Override
    public Dishes getById(Integer id) {
        return dishesDao.getById(id);
    }

    /**
     * 根据姓名查找用户信息
     *
     * @param disheName
     * @return
     */
    @Override
    public List<Dishes> getByName(String disheName) {
        return dishesDao.getByName(disheName);
    }

    @Override
    public List<Dishes> listAll() {
        return dishesDao.ListAll();
    }

    @Override
    public List<Dishes> searchAll(String dishName, int dishTypeNumber) {
        return dishesDao.searchAll(dishName,dishTypeNumber);
    }

    /**
     * 插入菜品记录/对应service功能
     *
     * @param dishes
     * @return
     */
    @Override
    public int insert(Dishes dishes) {
        return dishesDao.insert(dishes);
    }
}
